﻿using PlutoStudio.Domain.UnitOfWork;
using System;
using System.Collections.Generic;
using System.Text;
using PlutoStudio.Configuration.Startup;
using PlutoStudio.Dependency;
using PlutoStudio.EF.Configuration;

namespace PlutoStudio.EF
{
    //public class ConnectionStringResolver : DefaultConnectionStringResolver
    //{
    //    private readonly IIocResolver _iocResolver;
    //    public ConnectionStringResolver(IIocResolver iocResolver, IStartupConfiguration configuration) : base(configuration)
    //    {
    //        _iocResolver = iocResolver;
    //    }

    //    public override string GetNameOrConnectionString(ConnectionStringResolveArgs args)
    //    {
    //        var contextType = args["DbContextConcreteType"] as Type;
    //        var type = typeof(IDbContextConfigurer<>);
    //        type=type.MakeGenericType(contextType);
    //        var config = _iocResolver.Resolve(type) ;

    //        using (var configurer = _iocResolver.ResolveAsDisposable())
    //        {
    //            configurer.Value.Configure(configuration);
    //        }

    //        return base.GetNameOrConnectionString(args);
    //    }
    //}
}
